<!-- 头部 -->
<include file="Public:header" />
        <form class="layui-form" method="post">
        <!-- header-section end-->
        <div class="index-wrapper" style="background: #fff;padding-bottom: 0px;">  
            <div class="product-list" style="padding: 10px 20px;margin: 0px;">
                <span>法人代表:</span>
                <input type="text" name="sfzname" lay-verify="sfzname" placeholder="请输入法人姓名" style="border: 0px;background: #F1F2F7;width: 65%;height: 25px;border-radius: 15px;" value="{$res_info.sfzname}">
            </div>
            <div class="product-list" style="padding: 10px 20px;margin: 0px;">
                <span>证件号码:</span>
                <input type="text" name="sfznum" lay-verify="sfznum" placeholder="请输入证件号码" style="border: 0px;background: #F1F2F7;width: 65%;height: 25px;border-radius: 15px;" value="{$res_info.sfznum}">
            </div>

            <div class="product-list" style="padding: 10px 20px;margin: 0px;">
                <span>登记证书:</span>
                <?php if (empty($res_info['sfzz'])) { ?>
                    <span style="position: relative;left: 60%;color: #B0B0B0;font-size: 8px;">未上传</span>
                <?php }else { ?>
                    <span style="position: relative;left: 60%;color: #B0B0B0;font-size: 8px;">已上传</span>
                <?php } ?>
                <div style="width: 100%;background: #fff;padding: 0px;margin: 0px;">
                    <div style="float: left;">
                        <img id="LAY_demo_uploadz" src="<?php if ($res_info['sfzz']) { ?> __ROOT__{$res_info['sfzz']}<?php }else { ?>__PUBLIC__/home/images/qt/cszz.png<?php }?>" alt="" style="width: 160px;height: 100px;">
                    </div>
                    <div style="padding-left: 165px;position: relative;padding-top: 10px;height: 120px;border-bottom: 1px solid #f0f0f0;">
                        <div style="width: 50px;height: 50px;border: 1px solid #999;border-radius: 8px;margin-left: 40px;">
                            <span style="font-size: 30px;position: relative;left: 15px;top: 8px;">+</span>
                        </div>
                        <div class="site-demo-upbar" style="position: absolute;top: 15px;opacity: 0;">
                            <input type="file" name="file" class="layui-upload-file" id="sfzz">
                        </div>
                        <p style="font-size: 8px;">请上传少于1M的图片</p>
                    </div>
                </div>
            </div>

            <div class="product-list" style="padding: 10px 20px;margin: 0px;">
                <span>所在单位:</span>
                <input type="text" name="gsname" lay-verify="gsname" placeholder="如：某某公司" style="border: 0px;background: #F1F2F7;width: 65%;height: 25px;border-radius: 15px;" value="{$res_info.gsname}">
            </div>
            <div class="product-list" style="padding: 10px 20px;margin: 0px;">
                <span>个人简介描述:</span>
                <textarea name="jianjie" lay-verify="jianjie" cols="35%" rows="4" style="border: 0px;background: #F1F2F7;border-radius: 8px;width: 90%;" placeholder="用简洁有趣的文字介绍自己。">{$res_info.jianjie}</textarea>
            </div>

            <div class="product-list" style="padding: 10px 20px;margin: 0px;">
                <span>手机号:</span>
                <input  type="text" name="phone" lay-verify="phone" placeholder="请输入联系人手机" style="border: 0px;background: #F1F2F7;width: 65%;height: 25px;border-radius: 15px;">
            </div>
            <div class="product-list" style="padding: 10px 20px;margin: 0px;margin-bottom: 20px;">
                <span>验证码:</span>
                <input type="text" name="yzm" lay-verify="yzm" placeholder="请输入手机验证码" style="border: 0px;background: #F1F2F7;width: 45%;height: 25px;border-radius: 15px;">
            </div>
            <a href="javascript:void(0);" id="getCode" onclick="get_mobile_valid();" style="position: absolute;right: 50px;top: 500px;background: #EBA524;padding: 5px;color: #fff;font-size: 10px;border-radius: 5px;">获取验证码</a>
            <p style="color: red;text-align: center;">审核通过即可创建项目</p>
            <?php if ($res_info) { ?>
                <?php if ($res_info['is_rz'] == 0) { ?>
                    <button lay-submit="" lay-filter="*" style="background-color: #FF921D;color: #fff;width: 100%;height: 46px;border:0px;">审核中(信息可直接修改)</button>
                <?php } else { ?>
                    <a href="{:U('setup/chuangj',['rztype'=>$res_info['rztype']])}" style="background-color: #FF921D;color: #fff;width: 100%;display: block;text-align: center;font-size: 20px;line-height: 46px;">
                       创建项目</a>
                <?php } ?>
            <?php }else { ?>
                <button lay-submit="" lay-filter="*" style="background-color: #FF921D;color: #fff;width: 100%;height: 46px;border:0px;">提交信息</button>
            <?php } ?>
        </form>   
        </div>

<script type="text/javascript">
    layui.use(['form','layer','upload'], function(){
       $ = layui.jquery;
      var layer = layui.layer
      ,form = layui.form();
      //layer.msg('Hello World');
    //自定义验证规则
    form.verify({
      sfzname: function(value){
        if(value.length < 1){
          return '请输入姓名';
        }
      }
      ,sfznum: function(value){
        if(value.length < 1){
          return '请输入证件号码';
        }
      }
      ,gsname: function(value){
        if(value.length < 1){
          return '请输入所在单位';
        }
      }
      ,jianjie: function(value){
        if(value.length < 1){
          return '请输入个人简介';
        }
      }
      ,phone: function(value){
        if(value.length < 1){
          return '请输入手机号';
        }
      }
      ,yzm: function(value){
        if(value.length < 1){
          return '请输入验证码';
        }
      }
    });
    
    layui.upload({
        url: '{:U("setup/sfzz")}' //上传接口
        ,elem: '#sfzz' //指定原始元素，默认直接查找class="layui-upload-file"
        ,success: function(res){ //上传成功后的回调
          //console.log(res)
          //location.reload();
          LAY_demo_uploadz.src = res.data.src;
        }
    });

      //交互
    form.on('submit(*)', function(data){
        $.ajax({
            url: "{:U('setup/cis')}",//请求地址
            type: "post",//请求方式
            dataType: "json",//返回数据类型
            data: data.field,//发送的参数
            })
            .done(function(response) {
                  if(response.error==0){
                     layer.msg(response.info ,{icon:5});
                  }else{
                     layer.msg(response.info ,{icon:6});
                     //location.href = response.url;
                     location.reload();
                  }
              })
            .fail(function() {
                alert("ajxs交互失败");
            })  

          return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });   

    });

    /*发送短信验证码*/
    function get_mobile_valid(){
        layer.confirm('确认要发送吗？',function(index){
            //发异步删除数据
            var to = $('input[name="phone"]').val();
            $.ajax({
                url: "{:U('index/send_to')}",//请求地址
                type: "post",//请求方式
                dataType: "json",//返回数据类型
                data: {to:to},//发送的参数
                })
                .done(function(response) {
                      if(response.error==1){
                        layer.msg(response.info ,{icon:6});
                      }else{
                        layer.msg(response.info ,{icon:5});
                      }
                  })
                .fail(function() {
                    alert("ajxs交互失败");
                })  
            return false;
        });
    }

</script>

    </body>
</html>